import axios from "axios";



const instance = axios.create({
    baseURL: "https://apis.netstart.cn/ximalaya",

})

instance.interceptors.request.use(config => {
    console.log(config.url)
    if (config.url.includes('/index/queryIndexCategoryTabContent?moduleKey=') || config.url.includes('/album/queryAlbumPage/') || config.url.includes('/anchor/queryAnchorPage/') || config.url.includes('/rank/queryRankClusterDetail') || config.url.includes('/ting/categories') || config.url.includes('ting/categorySubjectList/')) {
        var flag = true
        localStorage.setItem('flag', flag)
    }
    if (config.url.includes('rank/queryRank') || config.url.includes('ting/categories') || config.url.includes('/category/queryCategoryPage')) {
        let flag = true
        localStorage.setItem('loading', flag)
    }

    if (config.url.includes('search/hotWordBillboardList')) {
        let isLoading = true
        localStorage.setItem('isLoading', isLoading)
    }

    return config
}, err => {
    return Promise.reject(err)
})

instance.interceptors.response.use(res => {


    return res
}, err => {
    return Promise.reject(err)
})

export default instance